/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Source;

import java.util.logging.Level;
import java.util.logging.Logger;
import net.jxta.discovery.DiscoveryService;

/**
 *
 * @author Miguel
 */
public class ThreadListeningRequestFile extends Thread {
 private DiscoveryService discovery;
    
    public ThreadListeningRequestFile(DiscoveryService d) {
             this.discovery = d;

    }
    
    @Override
    public void run() {
         while (true) {
            try {
                long waittime = 60 * 1 * 100L;
                discovery.getRemoteAdvertisements(null, DiscoveryService.ADV, "tipo_De_Anuncio", "anuncio", 1000, null);
                discovery.getRemoteAdvertisements(null, DiscoveryService.ADV, "tipo_De_Anuncio", "respuesta", 1000, null);
                 discovery.getRemoteAdvertisements(null, DiscoveryService.ADV, "tipo_De_Anuncio", "Guardar", 1000, null);
                System.out.println("Sleeping for :" + waittime);
                Thread.sleep(waittime);
            } catch (InterruptedException ex) {
                Logger.getLogger(ThreadListeningRequestFile.class.getName()).log(Level.SEVERE, null, ex);
            }
         }

    }
}
